package com.lj.edu.web.controller.base;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public abstract class BaseController<T> {

	protected static String Manage_Page;
	protected static String Info_Page;
	protected static String Edit_Page;

	public  static final String Manage = "manage";
	public static final String Info = "info";
	public static final String Edit = "edit";

	public BaseController() {
		// 1.获取泛型的类信息
		ParameterizedType type = (ParameterizedType) this.getClass().getGenericSuperclass();

		System.out.println("===============" + type);
		// 1.获取泛型真实类型

		Type[] types = (Type[]) type.getActualTypeArguments();
		// 2.把type类型赋值给Class类型
		
		Class<T> clz = (Class<T>) types[0];
		System.out.println("===============" + clz);

		String modeltype = clz.getSimpleName().toLowerCase();
		
		
		System.out.println("===============" + modeltype);
		
		Manage_Page = modeltype+"/"+Manage;
		Info_Page = modeltype+"/"+Info;
		Edit_Page = modeltype+"/"+Edit;
		
	}

}
